package cl.tinet.finalexam.model;

import java.io.Serializable;
import java.sql.Date;
import java.sql.Time;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@Entity
@Table(name="reservas")
public class ReserveModel implements Serializable{

    /**
     * Serial version of the class.
     */
    private static final long serialVersionUID = 1L;

    @ManyToOne(fetch = FetchType.EAGER, optional = false, targetEntity = UserModel.class)
    @JoinColumn(name = "userIDRes", referencedColumnName = "userID", insertable=false, updatable=false)
    private UserModel userEntity = new UserModel();
    
    @ManyToOne(fetch = FetchType.EAGER, optional = false, targetEntity = ClassroomModel.class)
    @JoinColumn(name = "salaIDRes", referencedColumnName = "salaID", insertable=false, updatable=false)
    private ClassroomModel classroomEntity = new ClassroomModel();
    
    /**
     * Link id reserve from BD.
     */
    @Id 
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "ReservaID")
    private int idReserve;
    
    /**
     * Link id reserve from BD.
     */
    @Column(name = "salaIDRes")
    private int roomCode;

    /**
     * Link Name from BD.
     */
    @Column(name = "userIDRes")
    private int username;

    /**
     * Link Last Name from BD.
     */
    @Column(name = "fechaInicio")
    private Date startDate;

    /**
     * Link password from BD.
     */
    @Column(name = "fechaTermino")
    private Date endDate;

    /**
     * Link user type from BD.
     */
    @Column(name = "horaInicio")
    private Time startTime;
    
    @Column(name = "horaTermino")
    private Time endTime;

    public ReserveModel(){
        
    }
    /**
     * TODO doc information expected for ReserveModel constructor.
     *
     * @param roomCode
     * @param username
     * @param startDate
     * @param endDate
     * @param startTime
     * @param endTime
     * @param comment
     */
    public ReserveModel(int roomCode, int username, Date startDate,
            Date endDate, Time startTime, Time endTime) {
        super();
        this.roomCode = roomCode;
        this.username = username;
        this.startDate = startDate;
        this.endDate = endDate;
        this.startTime = startTime;
        this.endTime = endTime;
    }
    /**
     * Allows to get the userEntity attribute value.
     * @return the userEntity value.
     */
    public UserModel getUserEntity() {
        return userEntity;
    }
    /**
     * Allows to set the userEntity attribute value.
     *
     * @param userEntity new value for userEntity attribute.
     */
    public void setUserEntity(UserModel userEntity) {
        this.userEntity = userEntity;
    }
    /**
     * Allows to get the classroomEntity attribute value.
     * @return the classroomEntity value.
     */
    public ClassroomModel getClassroomEntity() {
        return classroomEntity;
    }
    /**
     * Allows to set the classroomEntity attribute value.
     *
     * @param classroomEntity new value for classroomEntity attribute.
     */
    public void setClassroomEntity(ClassroomModel classroomEntity) {
        this.classroomEntity = classroomEntity;
    }
    /**
     * Allows to get the idReserve attribute value.
     * @return the idReserve value.
     */
    public int getIdReserve() {
        return idReserve;
    }
    /**
     * Allows to set the idReserve attribute value.
     *
     * @param idReserve new value for idReserve attribute.
     */
    public void setIdReserve(int idReserve) {
        this.idReserve = idReserve;
    }
    /**
     * Allows to get the roomCode attribute value.
     * @return the roomCode value.
     */
    public int getRoomCode() {
        return roomCode;
    }
    /**
     * Allows to set the roomCode attribute value.
     *
     * @param roomCode new value for roomCode attribute.
     */
    public void setRoomCode(int roomCode) {
        this.roomCode = roomCode;
    }
    /**
     * Allows to get the username attribute value.
     * @return the username value.
     */
    public int getUsername() {
        return username;
    }
    /**
     * Allows to set the username attribute value.
     *
     * @param username new value for username attribute.
     */
    public void setUsername(int username) {
        this.username = username;
    }
    /**
     * Allows to get the startDate attribute value.
     * @return the startDate value.
     */
    public Date getStartDate() {
        return startDate;
    }
    /**
     * Allows to set the startDate attribute value.
     *
     * @param startDate new value for startDate attribute.
     */
    public void setStartDate(Date startDate) {
        this.startDate = startDate;
    }
    /**
     * Allows to get the endDate attribute value.
     * @return the endDate value.
     */
    public Date getEndDate() {
        return endDate;
    }
    /**
     * Allows to set the endDate attribute value.
     *
     * @param endDate new value for endDate attribute.
     */
    public void setEndDate(Date endDate) {
        this.endDate = endDate;
    }
    /**
     * Allows to get the startTime attribute value.
     * @return the startTime value.
     */
    public Time getStartTime() {
        return startTime;
    }
    /**
     * Allows to set the startTime attribute value.
     *
     * @param startTime new value for startTime attribute.
     */
    public void setStartTime(Time startTime) {
        this.startTime = startTime;
    }
    /**
     * Allows to get the endTime attribute value.
     * @return the endTime value.
     */
    public Time getEndTime() {
        return endTime;
    }
    /**
     * Allows to set the endTime attribute value.
     *
     * @param endTime new value for endTime attribute.
     */
    public void setEndTime(Time endTime) {
        this.endTime = endTime;
    }
    
}
